import React from 'react'
import { Rate } from 'antd';
import styles from '../css/movieItem.scss'
import { Link ,Route} from 'react-router-dom';

export default class MovieList extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            id: this.props.id
        }
    }

    render() {
        return <div className={styles.box} onClick={this.goDetail}>
                <img src={this.props.images.small} className={styles.img}></img>
                <h4>电影名称：{this.props.title}</h4>
                <h4>上映年份：{this.props.year}</h4>
                <h4>上映类型：{this.props.genres.join(',')}</h4>
                <Rate disabled defaultValue={this.props.rating.average / 2} />
        </div>
    }
    goDetail = () => {
        // console.log(this.props.history)
        this.props.history.push('/movie/detail/' + this.state.id)
    }

}